<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>  

var arr=[1.8,1.7,3,1.2]
arr.sort();
console.log(arr.sort());//Array [ 1.2, 1.7, 1.8, 3 ]
var max=arr[0]
var min=arr[0]
for(var i = 1;i<arr.length;i++){
   if(max<arr[i]){
       max=arr[i]
   } 
   if(min>arr[i]){
       min=arr[i]
   }
}
console.log(max);
console.log(min);






    
</script>